{% extends "base.html" %}
{% load i18n future mezzanine_tags blog_tags keyword_tags disqus_tags %}

{% block meta_title %}{% if tag %}{{ tag }}{% elif month %}{{ month }}'s Blog{% elif author %} {{ author.get_full_name|default:author.username }}{% elif page %}{{ page.meta_title }}
{% else %}{% trans "博客" %}
{% endif %}{% endblock %}

{% block meta_keywords %}{% metablock %}
{% keywords_for page as keywords %}
{% for keyword in keywords %}
    {% if not forloop.first %}, {% endif %}
    {{ keyword }}
{% endfor %}
{% if tag %}
{{ tag }}, tag
{% endif %}
{% if category %}
{{ category }}, category
{% endif %}
{% if month %}
{{ month }}, month
{% endif %}
{% if author %} {{ author.get_full_name|default:author.username }}
{% endif %}
{% endmetablock %}{% endblock %}

{% block meta_description %}{% metablock %}
{{ page.description }}
{% endmetablock %}{% endblock %}

{% block title %}
{% if tag %}
{{ tag }}
{% elif page %}
{% editable page.title %}{{ page.title }}{% endeditable %}
{% else %}
{% trans "博客" %}
{% endif %}
{% endblock %}

{% block breadcrumb_menu %}
{{ block.super }}
{% if tag or category or year or month or author %}
<span>{% spaceless %}
{% if tag %}
    {% trans "Tag:" %} {{ tag }}
{% else %}{% if category %}
    {% trans "Category:" %} {{ category }}
{% else %}{% if year or month %}
    {% if month %}{{ month }}, {% endif %}{{ year }}
{% else %}{% if author %}
    {% trans "作者:" %} {{ author.get_full_name|default:author.username }}
{% endif %}{% endif %}{% endif %}{% endif %}
{% endspaceless %}
</span>
{% endif %}
{% endblock %}

{% block main %}

{% if tag or category or year or month or author %}
    {% block blog_post_list_filterinfo %}
    <h2 class="section--center mdl-grid mdl-cell--11-col">
    {% if tag %}
        {% trans "查看标签" %} {{ tag }}
    {% else %}{% if category %}
        {% trans "查看分类" %} {{ category }}
    {% else %}{% if year or month %}
        {% trans "Viewing posts from" %} {% if month %}{{ month }}, {% endif %}
        {{ year }}
    {% else %}{% if author %}
        {% trans "查看作者" %}
        {{ author.get_full_name|default:author.username }}
    {% endif %}{% endif %}{% endif %}{% endif %}
    {% endblock %}
    </h2>
{% else %}
    {% if page %}
    {% block blog_post_list_pagecontent %}
    {% if page.get_content_model.content %}
        {% editable page.get_content_model.content %}
        {{ page.get_content_model.content|richtext_filters|safe }}
        {% endeditable %}
    {% endif %}
    {% endblock %}
    {% endif %}
{% endif %}

{% for blog_post in blog_posts.object_list %}
{% block blog_post_list_post_title %}
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp mdl-cell--11-col blog-list">
{% editable blog_post.title %}
<div class="mdl-card__title mdl-card--border mdl-card--expand">
    <h2 class="mdl-card__title-text">
        <a href="{{ blog_post.get_absolute_url }}">{{ blog_post.title }} › </a>
    </h2>
</div>
{% endeditable %}
{% endblock %}

<div class="mdl-card__supporting-text">
{% block blog_post_list_post_metainfo %}
{% editable blog_post.publish_date %}
<h6 class="post-meta">
    {% trans "Posted by" %}:
    {% with blog_post.user as author %}
    <a href="{% url "blog_post_list_author" author %}">{{ author.get_full_name|default:author.username }}</a>
    {% endwith %}
    {% with blog_post.categories.all as categories %}
    {% if categories %}
    {% trans "in" %}
    {% for category in categories %}
    <a href="{% url "blog_post_list_category" category.slug %}">{{ category }}</a>{% if not forloop.last %}, {% endif %}
    {% endfor %}
    {% endif %}
    {% endwith %}
    <span >{{ blog_post.publish_date }}</span>
</h6>
{% endeditable %}
{% endblock %}

{% if settings.BLOG_USE_FEATURED_IMAGE and blog_post.featured_image %}
{% block blog_post_list_post_featured_image %}
<a href="{{ blog_post.get_absolute_url }}">
    <img class="img-thumbnail pull-left" src="{{ MEDIA_URL }}{% thumbnail blog_post.featured_image 90 90 %}">
</a>
{% endblock %}
{% endif %}

{% block blog_post_list_post_content %}

{% editable blog_post.content %}
{{ blog_post.description_from_content|safe }}
{% endeditable %}

{% endblock %}

{% block blog_post_list_post_links %}
    <div>
        {% keywords_for blog_post as tags %}
        {% if tags %}
        <ul class="list-inline tags">
        {% trans "Tags" %}:
        {% spaceless %}
        {% for tag in tags %}
        <li><a href="{% url "blog_post_list_tag" tag.slug %}" class="tag">{{ tag }}</a></li>
        {% endfor %}
        {% endspaceless %}
        </ul>
        {% endif %}
    </div>
</div>
    <div class="mdl-card__actions mdl-card--border">
        <a href="{{ blog_post.get_absolute_url }}" class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">{% trans "read more" %}</a>
        <a href="{{ blog_post.get_absolute_url }}" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon" data-upgraded=",MaterialButton,MaterialRipple">
            <i class="material-icons" role="presentation">arrow_forward</i>
                <span class="mdl-button__ripple-container">
                  <span class="mdl-ripple is-animating" style="width: 92.5096679918781px; height: 92.5096679918781px; -webkit-transform: translate(-50%, -50%) translate(22px, 23px); transform: translate(-50%, -50%) translate(22px, 23px);">

                  </span>
              </span>
        </a>
        {% if blog_post.allow_comments %}
        /
            {% if settings.COMMENTS_DISQUS_SHORTNAME %}
            <a href="{{ blog_post.get_absolute_url }}#disqus_thread"
            data-disqus-identifier="{% disqus_id_for blog_post %}">
            {% trans "Comments" %}
            </a>
            {% else %}
            <a href="{{ blog_post.get_absolute_url }}#comments">
                {% blocktrans count comments_count=blog_post.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %}
            </a>
            {% endif %}
        {% endif %}
    </div>
{% endblock %}
</section>
{% endfor %}

{% pagination_for blog_posts %}


{% endblock %}

{% block right_panel %}
{% include "blog/includes/filter_panel.html" %}
{% endblock %}
